package com.cyc.basic.test.doubletest;

import java.util.Random;

/**
 * @author chenyunchang
 * @version 1.0
 * @title
 * @date 2021/5/24 14:39
 * @Description:
 */
public class DoubleTest2 {

    public static void main(String[] args) {
        queryHongBao();
    }

    /**
     * 取double范围内的随机数
     * @return
     */
    public static Double queryHongBao() {
        Random rand = new Random();
        double MAX=6.88;
        double MIN=0.68;
        double result=0;
        for(int i=0; i<10; i++){
            result = MIN + (rand.nextDouble() * (MAX - MIN));
            result = (double) Math.round(result * 100) / 100;
            System.out.println(result);
        }
        return result;
    }

}
